package com.yuanfeng.job.job;


import com.yuanfeng.job.service.UpdateActivityStatusService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author lxt
 *限时活动
 */
public class UpdateActivityGoodsStatus implements BaseJob {

	private static final Logger logger = LoggerFactory.getLogger(UpdateActivityGoodsStatus.class);

	@Autowired
	UpdateActivityStatusService updateActivityStatusService;

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		// 限时折扣过期状态更新
		logger.info("限时折扣过期状态更新");

		updateActivityStatusService.updatePromotionGoods();

		updateActivityStatusService.updatePromotionDiscountBase();

		updateActivityStatusService.updatePromotionDiscountGoods();

		// 限时折扣预热状态更新
		logger.info("限时折扣预热状态更新");

		updateActivityStatusService.updatePromotionDiscountBase2();

		updateActivityStatusService.updatePromotionDiscountGoods2();

		// 限时折扣开始状态更新
		logger.info("限时折扣开始状态更新");

		updateActivityStatusService.updatePromotionDiscountBase3();

		updateActivityStatusService.updatePromotionDiscountGoods3();


		// 拼团过期状态更新
		logger.info("拼团状态更新");

		updateActivityStatusService.updatePintuanMarkStatus();

		updateActivityStatusService.updatePintuanGoods();

		updateActivityStatusService.updatePintuanStatus();

		// 满减赠折过期状态更新
		logger.info("满减赠折过期状态更新");

		updateActivityStatusService.updateManjianzengzheGoods();

		updateActivityStatusService.updateManjianzengzheStatus();


		// 秒杀过期状态更新
		logger.info("秒杀过期状态更新");

		updateActivityStatusService.updateSkillGoodsStatus();

		updateActivityStatusService.updateSkillGoods();

		updateActivityStatusService.updateGoodsStatus();

		// 秒杀开始状态更新
		logger.info("秒杀开始状态更新");

		updateActivityStatusService.updateSkillGoods2();

		updateActivityStatusService.updateSkillGoodsStatus2();

		updateActivityStatusService.updateGoodsStatus2();

		// 更改当秒杀库存被抢空后，回到普通商品，秒杀库存退回时则改回秒杀商品
		updateActivityStatusService.updateSkillGoods3();

		// 拼团待开启状态更新
		logger.info("拼团待开启状态更新");

		updateActivityStatusService.updatePintuanStatus2();


		// 满减赠折过期状态更新
		logger.info("满减赠折待开始状态更新");

		updateActivityStatusService.updateManjianzengzheStatus2();

		// 满减赠折开始状态更新
		logger.info("满减赠折开始状态更新");

		updateActivityStatusService.updateManjianzengzheStatus2();

	}

}
